package com.example.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.example.Mapper.AdjustDao;
import com.example.pojo.Adjustprice;
import com.example.pojo.Materialzhu;
import com.example.pojo.Warehouse;
import com.example.vo.msq.Adjustvo;
import com.example.vo.zyz.pageBean;

//调价单
@Service
@Transactional(propagation=Propagation.REQUIRED)
public class AdjustBiz {
	@Autowired
	private AdjustDao adao;

	//查询仓库表
	public Warehouse queryware(String id){
		return adao.queryware(id);
	}
	
	//查询物料主文件
	public Materialzhu querymatter(String id){
		return adao.querymatter(id);
	}

	//调价单主祥查询
	public pageBean findAll(Integer pagesize){
		pageBean page = new pageBean();
		page.setPagenum(pagesize);
		page.setPagesize(1);
		page.setRowcount(adao.queryCount());
		List<Adjustvo> data = adao.queryAll(pagesize);
		page.setPagedata(data);
		return page;
	}

	//主祥新增
	public void addorModify(Adjustprice ap){
		if(adao.count(ap.getBillno())>0){
			adao.deleteAdjust(ap.getBillno());
		}
		adao.modifyOraddAdjust(ap);
	}

	//修改状态
	public void updateState(String id){
		adao.updateState(id);
	}

	//物理删除
	public void remove(String id){
		adao.deleteAdjust(id);
	}
	
	public void examine(double price,String proid,Integer num){
		adao.examine(price, proid, num);
	}
	
	public void Unexamine(double price,String proid,Integer num){
		adao.Unexamine(price, proid, num);
	}
}
